from rest_framework_jwt.settings import api_settings

def get_token(user):
    # 1.获取ｊｗｔ的方法
    jwt_payload_handler=api_settings.JWT_PAYLOAD_HANDLER
    jwt_encode_handler=api_settings.JWT_ENCODE_HANDLER
    # 2.生成载荷
    payload =jwt_payload_handler(user)
    # 3.生成口令
    token=jwt_encode_handler(payload)

    return token
